<!--查询指定用户-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>查询指定用户</title>
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css">
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>查询指定用户</legend>
</fieldset>
<!--面板-->
<div class="layui-card">
    <div class="layui-card-body">
        <label class="layui-form-label">用户账号</label>
        <div class="layui-input-inline">
            <input type="text" id="userId" class="layui-input">
        </div>
        <button onclick="search();" class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
    </div>
</div>

<div style="padding: 20px;">
    <!--面板-->
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header" style="font-size: large ">用户信息</div>
            <div class="layui-card-body" id="user"></div>
        </div>
    </div>
</div>

<script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script src="../lib/layui-v2.6.3/layui.js"></script>
<script>
    //搜索
    function search(){
        //设备编号
        var userId=$("#userId").val();
        $.ajax({
            url:"/user/" + userId,
            type:"GET",
            dataType:"JSON",
            success:function (user){
                if(user == null || user == undefined || user == ""){
                    layer.msg("该用户不存在");
                    return;
                }
                //处理用户信息
                $("#user").append("用户账号:"+ user["userId"]+"<br/>")
                    .append("用户名:"+ user["username"]+"<br/>")
                    .append("权限:"+ user["authority"]+"<br/>")
                    .append("电话:"+ user["phone"]+"<br/>")
                    .append("登陆密码:"+ user["password"]+"<br/>")
                    .append("用户邮箱:"+ user["email"]+"<br/>")
                    .append("上一次修改时间:"+ user["updateTime"]);
            },
        });
    }
</script>
</body>
</html>